//
//  PramasMontage.m
//  布丁动画项目
//
//  Created by apple on 15/10/1.
//  Copyright © 2015年 apple. All rights reserved.
//

#import "PramasMontage.h"


NSString * const Host = @"http://school.diaoyur.cn";

NSString * const SchoolApi = @"article/index?typeid=%ld&page=%ld";

NSString * const Charact = @"article/classify?typeid=%ld";

NSString * const BigCharact = @"article/list-by-type-id?typeid=%ld&page=%ld";

NSString * const SmallCharact = @"article/three-column-list?aid=%ld&page=%ld";

NSString * const Aticle = @"article/detail?article_id=%@";

@implementation PramasMontage

//装置参数
+ (NSDictionary *)deviceParams {
    NSUUID *uuid = [NSUUID UUID];//广告相关
    
    //设备参数
    UIDevice *device = [UIDevice currentDevice];
    return @{
             @"deviceKey":uuid.UUIDString,
             @"brand":@"Apple",//牌子
             @"channelId":@"App Store",//ID通道，频道
             @"model":device.model,//型号
             @"os":device.systemName,//操作系统
             @"osv":device.systemVersion,//操作系统提供商
             @"timestamp":@"1443513638"//时间戳
             };
}

//app参数
+ (NSDictionary *)appParams {
    return @{
             @"apiKey":@"yuki_ios",//应用程序编程接口
            @"auth1":@"aeb64759231cc3ab7d771273a555e4fb",//认证
             @"auth2":@"662a595550f05ed39f99367f2052f928",
             @"version":@"2.4.5"//版本
             };
}

//完整参数
+ (NSDictionary *)fullParams:(NSDictionary *)params {
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    
    [dic addEntriesFromDictionary:[self deviceParams]];
    
    [dic addEntriesFromDictionary:[self appParams]];
    
    if (params) {
        [dic addEntriesFromDictionary:params];
    }
    return dic;
    
   }


//接口地址
+ (NSString *)apiWithPath:(NSString *)path {
    return [Host stringByAppendingPathComponent:path];
}

//学堂接口首页
+(NSString *)SchoolMianPageApi:(NSInteger) typeid Page:(NSInteger )Page{
    if (Page==1) {
        return  [self apiWithPath:[NSString stringWithFormat:@"article/index?typeid=%ld",(long)typeid] ];
    }else{
        return [self apiWithPath:[NSString stringWithFormat:SchoolApi,(long)typeid,(long)Page]];
    }
}
//标签数组
+(NSString *)Charact:(NSInteger )Tyeid{

    return [self apiWithPath:[NSString stringWithFormat:Charact,(long)Tyeid]];

}
//大标签列表
+(NSString *)BigCharact:(NSInteger )typeid Page:(NSInteger )page{

    if (page==1) {
        return  [self apiWithPath:[NSString stringWithFormat:@"article/list-by-type-id?typeid=%ld",(long)typeid] ] ;
    }else{
        return [self apiWithPath:[NSString stringWithFormat:BigCharact,(long)typeid,(long)page]];
    }
}

//小标签列表
+(NSString *)SmallCharect:(NSInteger )Aid Page:(NSInteger )page{
    if (page==1) {
        return  [self apiWithPath:[NSString stringWithFormat:@"article/three-column-list?aid=%ld",(long)Aid] ] ;
    }else{
        return [self apiWithPath:[NSString stringWithFormat:SmallCharact,(long)Aid,(long)page]];
    }
}

//文章详情Body
+(NSString *)AticleBidy:(NSString *)aticleId{
    return [self apiWithPath:[NSString stringWithFormat:Aticle,aticleId]];

}
@end
